package com.zr.service.impl;

import com.zr.mapper.ManageMapper;
import com.zr.pojo.Paydivide;
import com.zr.pojo.PaydivideUpdateVo;
import com.zr.service.ManageService;
import com.zr.util.ResultBuildVo;
import com.zr.util.ResultVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by YZN on 2019/7/9 0009.
 */
@Service
public class ManageServiceImpl implements ManageService {
    @Autowired
    private ManageMapper manageMapper;
    @Override
    public ResultVo updateSubmit(PaydivideUpdateVo paydivideUpdateVo, HttpServletRequest request) {
        Integer loginId = (Integer) request.getSession().getAttribute("loginId");
        if (loginId == null){
            return ResultBuildVo.error("请登录", "500");
        }
        Paydivide paydivide = new Paydivide();
        BeanUtils.copyProperties(paydivideUpdateVo,paydivide);
        manageMapper.updateSubmit(loginId);
        return ResultBuildVo.success(paydivideUpdateVo);
    }
}
